package dev.hxliu.cn.util;

public class UserContext {
    /**
     * The request holder.
     */
    private static final ThreadLocal<Long> USER_INFO_IN_TOKEN_HOLDER = new ThreadLocal<>();

    public static Long get() {
        return USER_INFO_IN_TOKEN_HOLDER.get();
    }
    public static void set(Long userInfoInTokenBo) {
        USER_INFO_IN_TOKEN_HOLDER.set(userInfoInTokenBo);
    }

    public static void clean() {
        if (USER_INFO_IN_TOKEN_HOLDER.get() != null) {
            USER_INFO_IN_TOKEN_HOLDER.remove();
        }
    }
}
